<!DOCTYPE HTML PUBLIC "-//ORA//DTD CD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE>[Chapter 17] Hashtable</TITLE>
<META NAME="author" CONTENT="Mark Grand and Jonathan Knudsen">
<META NAME="date" CONTENT="Fri Aug  8 17:42:41 1997">
<META NAME="form" CONTENT="html">
<META NAME="metadata" CONTENT="dublincore.0.1">
<META NAME="objecttype" CONTENT="book part">
<META NAME="otheragent" CONTENT="gmat dbtohtml">
<META NAME="publisher" CONTENT="O'Reilly &amp; Associates, Inc.">
<META NAME="source" CONTENT="SGML">
<META NAME="subject" CONTENT="Java">
<META NAME="title" CONTENT="Java Fundamental Classes Reference">
<META HTTP-EQUIV="Content-Script-Type" CONTENT="text/javascript">
</HEAD>
<body vlink="#551a8b" alink="#ff0000" text="#000000" bgcolor="#FFFFFF" link="#0000ee">

<DIV CLASS=htmlnav>
<H1><a href='index.htm'><IMG SRC="gifs/smbanner.gif"
     ALT="Java Fundamental Classes Reference" border=0></a></H1>
<table width=515 border=0 cellpadding=0 cellspacing=0>
<tr>
<td width=172 align=left valign=top><A HREF="ch17_09.htm"><IMG SRC="gifs/txtpreva.gif" ALT="Previous" border=0></A></td>
<td width=171 align=center valign=top><B><FONT FACE="ARIEL,HELVETICA,HELV,SANSERIF" SIZE="-1">Chapter 17<br>The java.util Package</FONT></B></TD>
<td width=172 align=right valign=top><A HREF="ch17_11.htm"><IMG SRC="gifs/txtnexta.gif" ALT="Next" border=0></A></td>
</tr>
</table>

&nbsp;
<hr align=left width=515>
</DIV>
<DIV CLASS=refnamediv>
<H1>Hashtable</H1>

<H2>Name</H2>

Hashtable

</DIV>

<DIV CLASS=refsect1>
<h2 CLASS=refsect1><A CLASS="TITLE" NAME="ch17-REFSECT1-AUTOID.66">Synopsis</A></h2>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Class Name:<br>
<DD>

<P CLASS=para>
<tt CLASS=literal>java.util.Hashtable</tt>

<p>
<DT CLASS=varlistentry>Superclass:<br>
<DD>

<P CLASS=para>
<tt CLASS=literal>java.util.Dictionary</tt>

<p>
<DT CLASS=varlistentry>Immediate Subclasses:<br>
<DD>

<P CLASS=para>
<tt CLASS=literal>java.util.Properties</tt>

<p>
<DT CLASS=varlistentry>Interfaces Implemented:<br>
<DD>

<P CLASS=para>
<tt CLASS=literal>java.lang.Cloneable</tt>, 
<tt CLASS=literal>java.io.Serializable</tt>

<p>
<DT CLASS=varlistentry>Availability:<br>
<DD>

<P CLASS=para>
JDK 1.0 or later </DL>
</DIV>

<DIV CLASS=refsect1>
<h2 CLASS=refsect1><A CLASS="TITLE" NAME="ch17-REFSECT1-AUTOID.67">Description</A></h2>

<P CLASS=para>
The <tt CLASS=literal>Hashtable</tt> class is a concrete 
subclass of <tt CLASS=literal>Dictionary</tt> that builds a table of key/value pairs. Any non-<tt CLASS=literal>null</tt> 
object can be used as a key or as a value. The objects used as keys must 
implement the <tt CLASS=literal>equals()</tt> and 
<tt CLASS=literal>hashCode()</tt> methods in a way that computes comparisons
and hashcodes from the contents of an object. Once the 
table is built, a value can be efficiently retrieved by supplying its associated 
key. 

<P CLASS=para>
<tt CLASS=literal>Hashtable</tt> is an excellent example 
of how a well-written class can hide an arcane algorithm. The casual user 
simply instantiates a <tt CLASS=literal>Hashtable</tt> 
and uses <tt CLASS=literal>put()</tt> and <tt CLASS=literal>get()</tt> 
to add and retrieve key and value pairs. However,
when performance is an issue, you need to be aware of the considerations
discussed in the following paragraphs.

<P CLASS=para>
Internally, a <tt CLASS=literal>Hashtable</tt> keeps 
an array of key/value pairs. When a new key/value pair is 
added to a <tt CLASS=literal>Hashtable</tt>, it is 
added to the array at an index that is calculated from the hashcode of 
the key. If a key/value pair already exists at this index, the new 
pair is linked to the existing key and value. Thus, a <tt CLASS=literal>Hashtable</tt> 
has an overall structure of an array of linked lists. 

<P CLASS=para>
For a given key, the retrieval of the matching value from a <tt CLASS=literal>Hashtable</tt> 
is quite fast. The <tt CLASS=literal>Hashtable</tt> 
computes the hashcode of the key and uses it as an index into the array. 
Then it only needs to search the linked list of key/value pairs 
at that index to find a match for the given key. If the array is short, 
but the <tt CLASS=literal>Hashtable</tt> contains 
many key/value pairs, however, the linked lists will be lengthy, 
which adversely affects performance. 

<P CLASS=para>
A <tt CLASS=literal>Hashtable</tt> has a capacity, 
which is the length of its array, and a load factor, which determines when 
rehashing is performed. The load factor is a number between 0 and 1. If 
the number of key/value pairs added to the <tt CLASS=literal>Hashtable</tt> 
exceeds the capacity multiplied by the load factor, the capacity of the 
<tt CLASS=literal>Hashtable</tt> is increased and 
the key/value pairs are rehashed into the new array. Obviously, 
this is an undesirable performance hit, so if you know approximately how 
many items you will add to a <tt CLASS=literal>Hashtable</tt>, 
you should create one with an appropriate initial capacity. 

</DIV>

<DIV CLASS=refsect1>
<h2 CLASS=refsect1><A CLASS="TITLE" NAME="ch17-REFSECT1-AUTOID.68">Class Summary</A></h2>

<DIV CLASS=screen>
<P>
<PRE>
public class java.util.Hashtable extends java.util.Dictionary
             implements java.lang.Cloneable, java.io.Serializable {
  // Constructors
  public Hashtable();
  public Hashtable(int initialCapacity);
  public Hashtable(int initialCapacity, float loadFactor);
  // Instance Methods
  public synchronized void clear();
  public synchronized Object clone();
  public synchronized boolean contains(Object value);
  public synchronized boolean containsKey(Object key);
  public synchronized Enumeration elements();
  public synchronized Object get(Object key); 
  public boolean isEmpty();
  public synchronized Enumeration keys();
  public synchronized Object put(Object key, Object value);
  public synchronized Object remove(Object key); 
  public int size();
  public synchronized String toString();
  // Protected Instance Methods
  protected void rehash();
}
</PRE>
</DIV>

</DIV>

<DIV CLASS=refsect1>
<h2 CLASS=refsect1><A CLASS="TITLE" NAME="ch17-REFSECT1-AUTOID.69">Constructors</A></h2>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch17-REFSECT2-AUTOID.151">Hashtable</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch17-REFSECT3-AUTOID.171">public Hashtable()</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
This constructor creates a <tt CLASS=literal>Hashtable</tt> 
with a default capacity of 101 and a default load factor of .75. </DL>
</DIV>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch17-REFSECT3-AUTOID.172">public Hashtable(int initialCapacity)</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Parameters<br>
<DD>

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><tt CLASS=literal>initialCapacity</tt><br>
<DD>

<P CLASS=para>
The initial capacity. </DL>
<p>
<DT CLASS=varlistentry>Throws<br>
<DD>

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><tt CLASS=literal>IllegalArgumentException</tt><br>
<DD>

<P CLASS=para>
If <tt CLASS=literal>initialCapacity</tt> is less 
than or equal to zero. </DL>
<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
This constructor creates a <tt CLASS=literal>Hashtable</tt> 
with the given capacity and a default load factor of .75. </DL>
</DIV>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch17-REFSECT3-AUTOID.173">public Hashtable(int initialCapacity, float loadFactor)</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Parameters<br>
<DD>

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><tt CLASS=literal>initialCapacity</tt><br>
<DD>

<P CLASS=para>
The initial capacity.

<p>
<DT CLASS=varlistentry><tt CLASS=literal>loadFactor</tt><br>
<DD>

<P CLASS=para>
The load factor. </DL>
<p>
<DT CLASS=varlistentry>Throws<br>
<DD>

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><tt CLASS=literal>IllegalArgumentException</tt><br>
<DD>

<P CLASS=para>
If <tt CLASS=literal>initialCapacity</tt> or <tt CLASS=literal>loadFactor</tt> 
is less than or equal to zero. </DL>
<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
This constructor creates a <tt CLASS=literal>Hashtable</tt> 
with the given capacity and load factor. </DL>
</DIV>

</DIV>

</DIV>

<DIV CLASS=refsect1>
<h2 CLASS=refsect1><A CLASS="TITLE" NAME="ch17-REFSECT1-AUTOID.70">Instance Methods</A></h2>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch17-REFSECT2-AUTOID.152">clear</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch17-REFSECT3-AUTOID.174">public synchronized void clear()</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
This method removes all of the key/value 
pairs from this <tt CLASS=literal>Hashtable</tt>. </DL>
</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch17-REFSECT2-AUTOID.153">clone</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch17-REFSECT3-AUTOID.175">public synchronized Object clone()</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Returns<br>
<DD>

<P CLASS=para>
A copy of this <tt CLASS=literal>Hashtable</tt>. 

<p>
<DT CLASS=varlistentry>Overrides<br>
<DD>

<P CLASS=para>
<tt CLASS=literal>Object.clone()</tt> 

<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
This method returns a shallow copy of this <tt CLASS=literal>Hashtable</tt>. 
This means that the internal array of the <tt CLASS=literal>Hashtable</tt> 
is copied, but the keys and values themselves are not copied. </DL>
</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch17-REFSECT2-AUTOID.154">contains</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch17-REFSECT3-AUTOID.176">public synchronized boolean contains(Object value)</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Parameters<br>
<DD>

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><tt CLASS=literal>value</tt><br>
<DD>

<P CLASS=para>
The value to find. </DL>
<p>
<DT CLASS=varlistentry>Returns<br>
<DD>

<P CLASS=para>
<tt CLASS=literal>true</tt> if this <tt CLASS=literal>Hashtable</tt> 
contains the given value; <tt CLASS=literal>false</tt> 
otherwise. 

<p>
<DT CLASS=varlistentry>Throws<br>
<DD>

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><tt CLASS=literal>NullPointerException</tt><br>
<DD>

<P CLASS=para>
If the given value is <tt CLASS=literal>null</tt>. </DL>
<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
This method returns <tt CLASS=literal>true</tt> if 
the given value is contained in this <tt CLASS=literal>Hashtable</tt> 
object. The entire table is searched, which can be a time-consuming operation. </DL>
</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch17-REFSECT2-AUTOID.155">containsKey</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch17-REFSECT3-AUTOID.177">public synchronized boolean containsKey(Object key)</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Parameters<br>
<DD>

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><tt CLASS=literal>key</tt><br>
<DD>

<P CLASS=para>
The key to find. </DL>
<p>
<DT CLASS=varlistentry>Returns<br>
<DD>

<P CLASS=para>
<tt CLASS=literal>true</tt> if this <tt CLASS=literal>Hashtable</tt> 
contains the given value; <tt CLASS=literal>false</tt> 
otherwise. 

<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
This method returns <tt CLASS=literal>true</tt> if 
the given key is contained in this <tt CLASS=literal>Hashtable</tt> 
object. Because the key is hashed to perform the search, this method runs 
quite fast, especially in comparison to <tt CLASS=literal>contains()</tt>. </DL>
</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch17-REFSECT2-AUTOID.156">elements</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch17-REFSECT3-AUTOID.178">public synchronized Enumeration elements()</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Returns<br>
<DD>

<P CLASS=para>
The values in this <tt CLASS=literal>Hashtable</tt> 
as an <tt CLASS=literal>Enumeration</tt>. 

<p>
<DT CLASS=varlistentry>Overrides<br>
<DD>

<P CLASS=para>
<tt CLASS=literal>Dictionary.elements()</tt> 

<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
This method returns an <tt CLASS=literal>Enumeration</tt> 
that iterates through the values in this <tt CLASS=literal>Hashtable</tt>. </DL>
</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch17-REFSECT2-AUTOID.157">get</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch17-REFSECT3-AUTOID.179">public synchronized Object get(Object key)</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Parameters<br>
<DD>

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><tt CLASS=literal>key</tt><br>
<DD>

<P CLASS=para>
The key of the value 
to retrieve. </DL>
<p>
<DT CLASS=varlistentry>Returns<br>
<DD>

<P CLASS=para>
The value that corresponds to this key or <tt CLASS=literal>null</tt> 
if the key is not associated with any value. 

<p>
<DT CLASS=varlistentry>Overrides<br>
<DD>

<P CLASS=para>
<tt CLASS=literal>Dictionary.get()</tt> 

<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
This method returns the value that is associated with the given key. </DL>
</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch17-REFSECT2-AUTOID.158">isEmpty</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch17-REFSECT3-AUTOID.180">public boolean isEmpty()</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Returns<br>
<DD>

<P CLASS=para>
<tt CLASS=literal>true</tt> if there are no values 
in the <tt CLASS=literal>Hashtable</tt>; <tt CLASS=literal>false</tt> 
otherwise. 

<p>
<DT CLASS=varlistentry>Overrides<br>
<DD>

<P CLASS=para>
<tt CLASS=literal>Dictionary.isEmpty()</tt> 

<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
This method returns a <tt CLASS=literal>boolean</tt> 
value that indicates whether or not the <tt CLASS=literal>Hashtable</tt> 
is empty. </DL>
</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch17-REFSECT2-AUTOID.159">keys</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch17-REFSECT3-AUTOID.181">public synchronized Enumeration keys()</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Returns<br>
<DD>

<P CLASS=para>
The keys in the <tt CLASS=literal>Hashtable</tt> 
as an <tt CLASS=literal>Enumeration</tt>. 

<p>
<DT CLASS=varlistentry>Overrides<br>
<DD>

<P CLASS=para>
<tt CLASS=literal>Dictionary.keys()</tt> 

<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
This method returns an <tt CLASS=literal>Enumeration</tt> 
that iterates through the keys in this <tt CLASS=literal>Hashtable</tt>. </DL>
</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch17-REFSECT2-AUTOID.160">put</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch17-REFSECT3-AUTOID.182">public synchronized Object put(Object key, Object value)</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Parameters<br>
<DD>

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><tt CLASS=literal>key</tt><br>
<DD>

<P CLASS=para>
A key object.

<p>
<DT CLASS=varlistentry><tt CLASS=literal>value</tt><br>
<DD>

<P CLASS=para>
A value object. </DL>
<p>
<DT CLASS=varlistentry>Returns<br>
<DD>

<P CLASS=para>
The previous value associated with the given key or <tt CLASS=literal>null</tt> 
if <tt CLASS=literal>key</tt> has not previously been 
associated with a value. 

<p>
<DT CLASS=varlistentry>Throws<br>
<DD>

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><tt CLASS=literal>NullPointerException</tt><br>
<DD>

<P CLASS=para>
If either the key or the value is <tt CLASS=literal>null</tt>. </DL>
<p>
<DT CLASS=varlistentry>Overrides<br>
<DD>

<P CLASS=para>
<tt CLASS=literal>Dictionary.put()</tt> 

<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
This method associates the given key with the given value in this <tt CLASS=literal>Hashtable</tt>. </DL>
</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch17-REFSECT2-AUTOID.161">remove</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch17-REFSECT3-AUTOID.183">public synchronized Object remove(Object key)</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Parameters<br>
<DD>

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><tt CLASS=literal>key</tt><br>
<DD>

<P CLASS=para>
A key of the value 
to remove. </DL>
<p>
<DT CLASS=varlistentry>Returns<br>
<DD>

<P CLASS=para>
The value associated with the given key, or <tt CLASS=literal>null</tt> 
if <tt CLASS=literal>key</tt> is not associated with 
a value. 

<p>
<DT CLASS=varlistentry>Overrides<br>
<DD>

<P CLASS=para>
<tt CLASS=literal>Dictionary.remove()</tt> 

<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
This method removes a key/value pair from this <tt CLASS=literal>Hashtable</tt>. 
If the given key is not in the <tt CLASS=literal>Hashtable</tt>, 
the method does nothing. </DL>
</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch17-REFSECT2-AUTOID.162">size</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch17-REFSECT3-AUTOID.184">public int size()</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Returns<br>
<DD>

<P CLASS=para>
The number of key in the <tt CLASS=literal>Hashtable</tt>. 

<p>
<DT CLASS=varlistentry>Overrides<br>
<DD>

<P CLASS=para>
<tt CLASS=literal>Dictionary.size()</tt> 

<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
This method returns the number of key/value pairs in the <tt CLASS=literal>Hashtable</tt>. </DL>
</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch17-REFSECT2-AUTOID.163">toString</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch17-REFSECT3-AUTOID.185">public String toString()</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Returns<br>
<DD>

<P CLASS=para>
A string that represents this <tt CLASS=literal>Hashtable</tt>. 

<p>
<DT CLASS=varlistentry>Overrides<br>
<DD>

<P CLASS=para>
<tt CLASS=literal>Object.toString()</tt> 

<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
This method returns a string representation of this <tt CLASS=literal>Hashtable</tt>. 
The string includes every key/value pair that is contained in the 
<tt CLASS=literal>Hashtable</tt>, so the string returned 
by <tt CLASS=literal>toString()</tt> can be quite 
long. </DL>
</DIV>

</DIV>

</DIV>

<DIV CLASS=refsect1>
<h2 CLASS=refsect1><A CLASS="TITLE" NAME="ch17-REFSECT1-AUTOID.71">Protected Instance Methods</A></h2>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch17-REFSECT2-AUTOID.164">rehash</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch17-REFSECT3-AUTOID.186">protected void rehash()</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
This method increases the capacity of this <tt CLASS=literal>Hashtable</tt>. 
A larger internal array is created and all existing key/value pairs 
are rehashed into the new array. </DL>
</DIV>

</DIV>

</DIV>

<DIV CLASS=refsect1>
<h2 CLASS=refsect1><A CLASS="TITLE" NAME="ch17-REFSECT1-AUTOID.72">Inherited Methods</A></h2>

<DIV CLASS=informaltable>
<P>
<TABLE CLASS=INFORMALTABLE>
<TR CLASS=row>
<TH ALIGN="LEFT">

<P CLASS=para>
Method</TH>
<TH ALIGN="LEFT">

<P CLASS=para>
Inherited From</TH>
<TH ALIGN="LEFT">

<P CLASS=para>
Method</TH>
<TH ALIGN="LEFT">

<P CLASS=para>
Inherited From</TH>
</TR>
<TR CLASS=row>
<TD ALIGN="LEFT">

<P CLASS=para>
<tt CLASS=literal>equals(Object)</tt></TD>
<TD ALIGN="LEFT">

<P CLASS=para>
<tt CLASS=literal>Object</tt></TD>
<TD ALIGN="LEFT">

<P CLASS=para>
<tt CLASS=literal>finalize()</tt></TD>
<TD ALIGN="LEFT">

<P CLASS=para>
<tt CLASS=literal>Object</tt></TD>
</TR>
<TR CLASS=row>
<TD ALIGN="LEFT">

<P CLASS=para>
<tt CLASS=literal>getClass()</tt></TD>
<TD ALIGN="LEFT">

<P CLASS=para>
<tt CLASS=literal>Object</tt></TD>
<TD ALIGN="LEFT">

<P CLASS=para>
<tt CLASS=literal>hashCode()</tt></TD>
<TD ALIGN="LEFT">

<P CLASS=para>
<tt CLASS=literal>Object</tt></TD>
</TR>
<TR CLASS=row>
<TD ALIGN="LEFT">

<P CLASS=para>
<tt CLASS=literal>notify()</tt></TD>
<TD ALIGN="LEFT">

<P CLASS=para>
<tt CLASS=literal>Object</tt></TD>
<TD ALIGN="LEFT">

<P CLASS=para>
<tt CLASS=literal>notifyAll()</tt></TD>
<TD ALIGN="LEFT">

<P CLASS=para>
<tt CLASS=literal>Object</tt></TD>
</TR>
<TR CLASS=row>
<TD ALIGN="LEFT">

<P CLASS=para>
<tt CLASS=literal>wait()</tt></TD>
<TD ALIGN="LEFT">

<P CLASS=para>
<tt CLASS=literal>Object</tt></TD>
<TD ALIGN="LEFT">

<P CLASS=para>
<tt CLASS=literal>wait(long)</tt></TD>
<TD ALIGN="LEFT">

<P CLASS=para>
<tt CLASS=literal>Object</tt></TD>
</TR>
<TR CLASS=row>
<TD ALIGN="LEFT">

<P CLASS=para>
<tt CLASS=literal>wait(long, int)</tt></TD>
<TD ALIGN="LEFT">

<P CLASS=para>
<tt CLASS=literal>Object</tt></TD>
<TD ALIGN="LEFT">&nbsp;</TD>
<TD ALIGN="LEFT">&nbsp;</TD>
</TR>
</TABLE>
<P>
</DIV>

</DIV>

<DIV CLASS=refsect1>
<h2 CLASS=refsect1><A CLASS="TITLE" NAME="ch17-REFSECT1-AUTOID.73">See Also</A></h2>

<P CLASS=para>
<tt CLASS=literal>Cloneable</tt>, 
<tt CLASS=literal>Dictionary</tt>, 
<tt CLASS=literal>Enumeration</tt>, 
<tt CLASS=literal>IllegalArgumentException</tt>, 
<tt CLASS=literal>NullPointerException</tt>, 
<tt CLASS=literal>Properties</tt>, 
<tt CLASS=literal>Serializable</tt> 
</DIV>


<DIV CLASS=htmlnav>

<P>
<HR align=left width=515>
<table width=515 border=0 cellpadding=0 cellspacing=0>
<tr>
<td width=172 align=left valign=top><A HREF="ch17_09.htm"><IMG SRC="gifs/txtpreva.gif" ALT="Previous" border=0></A></td>
<td width=171 align=center valign=top><a href="index.htm"><img src='gifs/txthome.gif' border=0 alt='Home'></a></td>
<td width=172 align=right valign=top><A HREF="ch17_11.htm"><IMG SRC="gifs/txtnexta.gif" ALT="Next" border=0></A></td>
</tr>
<tr>
<td width=172 align=left valign=top>GregorianCalendar</td>
<td width=171 align=center valign=top><a href="index/idx_0.htm"><img src='gifs/index.gif' alt='Book Index' border=0></a></td>
<td width=172 align=right valign=top>ListResourceBundle</td>
</tr>
</table>
<hr align=left width=515>

<IMG SRC="gifs/smnavbar.gif" USEMAP="#map" BORDER=0> 
<MAP NAME="map"> 
<AREA SHAPE=RECT COORDS="0,0,108,15" HREF="../javanut/index.htm"
alt="Java in a Nutshell"> 
<AREA SHAPE=RECT COORDS="109,0,200,15" HREF="../langref/index.htm" 
alt="Java Language Reference"> 
<AREA SHAPE=RECT COORDS="203,0,290,15" HREF="../awt/index.htm" 
alt="Java AWT"> 
<AREA SHAPE=RECT COORDS="291,0,419,15" HREF="../fclass/index.htm" 
alt="Java Fundamental Classes"> 
<AREA SHAPE=RECT COORDS="421,0,514,15" HREF="../exp/index.htm" 
alt="Exploring Java"> 
</MAP>
</DIV>

</BODY>
</HTML>
